from operate_excel import OperateExcel
from Python基础.MySqlPractise.DBUtils import DBManager
def create_datas():
    OperateExcel.create_excel("test.xlsx", "test")
    datas= []
    for i in range(1,2001):
        data = []
        for j in range(1,11):
            data.append(j)
        datas.append(data)
    OperateExcel.write_excel("test.xlsx", "test", datas)

def write_datas_to_mysql():
    datas = OperateExcel.read_excel("test.xlsx", "test")
    dbManager = DBManager("localhost","root","20203219","test",'utf8')

    dbManager.create_table("test","create table test(id int,name int,age int,sex int,address int,phone int,email int,company int,position int,salary int)")
    dbManager.insert_datas(f"insert into `test` values({','.join(['%s'] * 10)})",datas)

if __name__ == '__main__':
    create_datas()
    write_datas_to_mysql()